<script type="text/x-template" id="loglist">
    <div>
        <el-container>
            <el-header>
                <div style="padding: 10px;height: 50px">
                    <el-form :model="searchform"  label-width="100px" class="demo-ruleForm">
                        <el-row>
                            <el-col :span="7">
                                <el-form-item label="栏目名称" >
                                    <el-input v-model="input" placeholder="请输入内容"></el-input>
                                </el-form-item>
                            </el-col>
                            <el-col :span="7">
                                <el-form-item label="栏目名称" >
                                    <el-input v-model="input" placeholder="请输入内容"></el-input>
                                </el-form-item>
                            </el-col>
                            <el-col :span="7">
                                <el-form-item label="栏目名称" >
                                    <el-input v-model="input" placeholder="请输入内容"></el-input>
                                </el-form-item>
                            </el-col>
                            <el-col :span="3">
                                <div align="center">
                                    <el-button type="primary">搜索</el-button>
                                </div>
                            </el-col>
                        </el-row>
                    </el-form>
                </div>
            </el-header>
            <el-container>
                <el-container>
                    <el-main>

                        <template>
                            <el-table
                                    :data="tableDatas"
                                    stripe
                                    style="width: 100%;min-height: 500px">
                                <el-table-column
                                        label="序号"
                                        align="center"
                                        type="index"
                                        width="100">
                                </el-table-column>
                                <el-table-column
                                        :show-overflow-tooltip="true"
                                        prop="logname"
                                        label="日志名称"
                                        width="250">
                                </el-table-column>
                                <el-table-column
                                        prop="ip"
                                        label="访问ip"
                                        width="180">
                                </el-table-column>
                                <el-table-column
                                        :show-overflow-tooltip="true"
                                        prop="title"
                                        label="文章标题"
                                        width="200">
                                </el-table-column>
                                <el-table-column
                                        prop="url"
                                        label="访问地址">
                                </el-table-column>
                                <el-table-column
                                        fixed="right"
                                        label="操作"
                                        width="200">
                                    <template slot-scope="scope">
                                        <el-button  type="text" size="small">下载</el-button>
                                        <el-button type="text" size="small">查看</el-button>
                                        <el-button type="text" size="small">编辑</el-button>
                                    </template>
                                </el-table-column>
                            </el-table>
                        </template>

                        <el-divider></el-divider>

                        <el-pagination
                                background
                                @current-change="handleCurrentChangeLogListPage"
                                layout="total,prev, pager, next"
                                :total="total">
                        </el-pagination>

                    </el-main>
                </el-container>
            </el-container>
        </el-container>



        <!-- 添加分组        -->
        <el-dialog title="添加分组" :visible.sync="dialogFormVisible_addgroup">

        </el-dialog>

    </div>
</script>

<script>
    let loglist={
        data() {
            return {
                multipleSelection:[],
                searchform:{},
                activeName_addfile:'first_addfilepath',
                dialogFormVisible_addpane:false,
                dialogFormVisible_addgroup : false,
                activeIndex: '1',
                activeIndex2: '1',
                total:0,
                input:'',
                filepath:'',
                tableDatas: [],
                search:'',
                keyword:'',
                defaultProps: {
                    children: 'children',
                    label: 'label'
                }
            }
        },
        template: '#loglist',
        created(){
           this.getlist(1);
        },
        methods: {
            handleClick(row){

            },
            handleCurrentChangeLogListPage(val) {
                console.log('11111111111111111')
                this.getlist(val);
            },
            getlist(val){
                api.GET('/log/page',{'pageNum':val,'pageSize':10,'keyword':this.keyword},(result)=> {
                    this.tableDatas=result.data.records;
                    this.total=result.data.total;
                })
            },
            handleClick_file(tab, event){
                console.log(tab, event);
            },
            handleSelect(key, keyPath) {
                console.log(key, keyPath);
            },
            addfilepane(){
                this.dialogFormVisible_addpane=true;
            },
            addfilegroup(){
                this.dialogFormVisible_addgroup=true;
            },
            handleCurrentChange(val) {
                api.GET('/log/page',{'pageNum':val,'pageSize':10,'keyword':this.keyword},(result)=> {
                    this.tableData=result.data.records;
                    this.total=result.data.total;
                })
            },
            locationfref(href){
                window.open(href);
            },
            handleNodeClick(data) {
                console.log(data);
            },
            locationppreview(id){
                window.open('/page/contentinfo.html?obj='+id)
            },
            updateNote(id){
                window.open('/page/update.html?obj='+id)
            },
            handleNodeClick(data) {
                console.log(data);
            },
            deleteNote(id){
                this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then(() => {
                    api.GET('/note/delete',{'id':id},(result)=> {
                        if(result.code==0){
                            this.$message({
                                showClose: true,
                                message: '删除成功',
                                type: 'success'
                            });
                            local.reload();
                        }
                    })
                }).catch(() => {
                    this.$message({
                        type: 'info',
                        message: '已取消删除'
                    });
                });
            }
        }
    }
    Vue.component('loglist',loglist);
</script>